<?php
/**
 *  Yz_Array_Interface
 *
 *  All Yz classes already implement ArrayAccess
 */
interface Yz_Array_Interface
{

    /** apply callback to each element and return a new array
     *
     *  the indices are not used nor affected in any way
     *  @param callback function(value): newValue
     *  @return Yz_Array_Interface
     */
    public function map($callback);

    /** apply callback to each indexed element and replace old values with new ones
     *
     *  the indices are used but can not be altered by callback
     *  @param callback function(index, value): newValue
     *  @return Yz_Array_Interface
     */
    public function apply($callback);

    /** filter values, optionally using a callback
     *
     *  the indices are not used
    *   @param callback $callback: bool callback( value ), or null for the default callback
    *       Filtering without a callback will remove any elements with a value of null,false,'' (empty string)
    *   @return Yz_Array_Interface
     */
    public function filter($callback=null);

}
